package code.jzh.compiler;

import code.jzh.compiler.scanner.DFA;
import code.jzh.compiler.scanner.Lexer;
import code.jzh.compiler.scanner.LexerType;
import code.jzh.compiler.scanner.MinimalDFA;
import code.jzh.compiler.scanner.NFA;
import code.jzh.compiler.scanner.Reader;
import code.jzh.compiler.scanner.RegularExpression;

public class Main {
	
	public static void main(String[] args) throws Exception {
//		String regularStr = "a(b|c)*";
//		String regularStr = "【0-9】×.【0-9】【0-9】×";
		/*String regularStr = "\"([a-b]|!|\\\")*\"";
		regularStr = RegularExpression.formatRegularExpression(regularStr);
		NFA nfa = NFA.buildNFA(regularStr);
		nfa.printNFA();
		System.out.println("---------------------------------------");
		nfa.testEpsilonClosure();
		System.out.println("---------------------------------------");
		DFA dfa = DFA.buildDFA(nfa);
		dfa.printDFA();
		System.out.println("---------------------------------------");
		MinimalDFA minimalDFA = MinimalDFA.buildMinimalDFA(dfa);
		minimalDFA.printMinimalDFA();*/
		/*for(LexerType l : LexerType.values()) {
			System.out.println(l.pattern+"--"+l.toString()+"--"+l.ordinal());
		}*/
		String sourceFile = Reader.readFile("test.jc");
		Lexer.process(sourceFile);
//		Lexer.process("int main(int argc) { \n \t\t int i = 12345*12;\n\n \t\t float j = 1.0;\n\t\t int x = i+j [];\n \t\tprintf(\"ha*[( \\\"!~**)*ha\");\n}");
//		Lexer.process("\"h\")");
//		Lexer.process("1.0");
	}
}
